﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<Hotnet.Entity.Video>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%=ViewData["Title"] %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<div>
		<div style=" font-size:x-large"><%=ViewData["Title"] %></div>
		<div style=" margin:15px 0px 3px 2px;">
			<span style=" color:Red;">
				所在位置:
			</span>
			<a href="/AdminVideoGroup/Index/?categoryID=<%=ViewData["CategoryID"] %>" style=" text-decoration:none;">
				<%=ViewData["CategoryName"] %>
			</a>
			->
			<%=ViewData["Title"] %>
		</div>
	</div>
	<div style=" text-align:center;color:Red; font-size:large"><%=TempData["UpdateResult"]%></div>
	<% using (Html.BeginForm("Create", "AdminVideoGroup",null, FormMethod.Post, new { enctype = "multipart/form-data",id="formCreateUpdate" }))
	{%>
	
	<input type="hidden" id="hiddenCategoryID" name="CategoryID" value="<%=ViewData["CategoryID"] %>" />
	<table width="100%" class="ma list">
		<tr>
			<td align="right">
				<label for="Name">
					视频组名称:</label>
			</td>
			<td>
				<%= Html.TextBox("Name")%>
			</td>
			<td align="right">
				视频Tag:
			</td>
			<td>
				<%= Html.TextBox("Tags")%>
			</td>
		</tr>
		<tr>
			<%--<td align="right">
				<label for="DefineType">
					设定归属列表:</label>
			</td>
			<td>
				<%=Html.DropDownList("DefineType", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumDefineType>("设定归属列表..", Convert.ToString((int)EnumDefineType.None)))%>
			</td>--%>
			
			<td align="right">
				<label for="SourceFromID">来源网站:</label>
			</td>
			<td>
				<input type="hidden" name="SourceFromID" id="SourceFromID" />
				<%Html.RenderPartial("SelectControl", ViewData["SourceFrom"]); %>
				<span id="SpanSourceFromID"></span>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label for="Director">导演:</label>
			</td>
			<td>
				<input type="hidden" name="Director" id="Director" />
				<%Html.RenderPartial("SelectControl", ViewData["Director"]); %>
				<span id="SpanDirector"></span>
			</td>
			
			
			
			<td align="right">
				<label for="DownLoadUrl">
					主角:</label>
			</td>
			<td>
				<input type="hidden" name="CastCharacters" id="CastCharacters" />
				<%Html.RenderPartial("SelectControl", ViewData["Star"]); %>
				<span id="SpanCastCharacters"></span>
			</td>
			
		</tr>
		<tr>
			<td align="right">
				<label for="previewYear">上映时间:</label>
			</td>
			<td>
				<%=Html.DropDownList("previewYear", Hotnet.Web.Controllers.Admin.AdminVideoController.PreviewTimeList, new { style = "width:120px;" })%>
			</td>
			
			<td align="right">
				<label for="IsCanPlayInner">
					是否内部播放:</label>
			</td>
			<td>
				<%=Html.CheckBoxRadioGroup("IsCanPlayInner", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumIsCanPlayInner>(), new List<string>() { Model == null ? Convert.ToString((int)EnumIsCanPlayInner.是) : (Model.IsCanPlayInner.Value ? Convert.ToString((int)EnumIsCanPlayInner.是) : Convert.ToString((int)EnumIsCanPlayInner.否)) }, 2, null, "50px", HtmlControlType.radio)%>
			</td>
			
		</tr>
		<tr>
			<td align="right">
				<label for="Zone">
					地区:</label>
			</td>
			<td>
				<%=Html.DropDownList("Zone", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumZone>("选择地区..", ""), new { style = "width:120px;" })%>
			</td>
			<td align="right">
				<label for="IsDVD">是否高清:</label>
			</td>
			<td>
				<%=Html.CheckBoxRadioGroup("IsDVD", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumIsDVD>(), new List<string>() { Model==null?Convert.ToString((int)EnumIsDVD.否):(Model.IsDVD.Value?Convert.ToString((int)EnumIsDVD.是):Convert.ToString((int)EnumIsDVD.否)) }, 2, null, "50px;", HtmlControlType.radio)%>
			</td>
			
		</tr>
		
		<tr>
			<td align="right">
				<label for="CoverImagePath">
					封面图片:</label>
			</td>
			<td >
				<input type="file" onchange="showPreviewImage();" id="CoverImage" name="coverImage" />
			</td>
			<td colspan="2">
				<img alt="封面图片" src='<%=Model==null?"#":Model.CoverImagePath %>' id="coverImg" style="width:110px;height:90px;" />
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<label for="Description">
					视频组描述:</label>
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<%= Html.TextArea("Description")%>
			</td>
		</tr>
		<tr>
			<td colspan="4" align="center">
				<input type="submit" value="确定" />
				<input type="button" value="返回" onclick="window.location.href='/AdminVideoGroup/Index/?categoryID=<%=ViewData["CategoryID"] %>'" />
			</td>
		</tr>
	</table>
	<% } %>
	
	
	<div id="flashPreview" style="display:none;">
		
	</div>
	
	<script type="text/javascript">
		var oFCKeditor = new FCKeditor('Description', "100%", "450");
		oFCKeditor.ReplaceTextarea();

		var categoryId = '<%=Model==null?ViewData["CategoryID"]:Model.CategoryID %>';
		var videoGroupId = '<%=Model==null?0:Model.VideoID %>';

		function setSourceFrom(result) {

			$("#SpanSourceFromID").html("");
			if (result.length == 0)
				return;
			$("#SpanSourceFromID").html(result[0].Text);
			$("#SourceFromID").attr("value",result[0].Value);
		}

		function setStar(result) {
			$("#SpanCastCharacters").html("");
			if (result.length == 0)
				return;
			var str = "";
			var strValue = "";
			for (var i = 0; i < result.length; i++) {
				str += result[i].Text + " "
				strValue += result[i].Value + ","
			}
			$("#SpanCastCharacters").html(str);
			$("#CastCharacters").attr("value", strValue);
			
		}

		function setDirector(result) {

			$("#SpanDirector").html("");
			if (result.length == 0)
				return;
			$("#SpanDirector").html(result[0].Text);
			$("#Director").attr("value", result[0].Value);
		}


		function showPreviewImage() {
			$('#coverImg').attr('src', $('#CoverImage').val())
			$('#coverImg').attr('style', "width:200px;height:150px;");
		}

		$(document).ready(
			function() {
				sc_calculateResult(2, setStar, 'checkbox');
				sc_calculateResult(1, setSourceFrom, 'radio');
				sc_calculateResult(3, setDirector, 'radio');
				if (videoGroupId != 0) {
					$("#formCreateUpdate").attr("action", "/AdminVideoGroup/Edit/" + videoGroupId);
					$("#hiddenCategoryID").attr("value", categoryId);

				}
				var childers = document.getElementById("DefineType").getElementsByTagName("option");
				document.getElementById("DefineType").removeChild(childers[childers.length - 1]);
			}
		);
		
	</script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="StyleContent" runat="server">
</asp:Content>
